home *** CD-ROM | disk | FTP | other *** search
Wrap
RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++)))) RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++)))) NNNNaaaammmmeeee RWTPtrSetIterator<T,C> - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss #include<rw/tpset.h> RWTPtrSet<T,C> set; RWTPtrSetIterator<T,C> itr(set); SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy DDDDeeeeppppeeeennnnddddeeeennnntttt!!!! RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr requires the Standard C++ Library. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr is supplied with Tools 7 to provide an iterator interface to the new Standard Library based collections that has backward compatibility with the container iterators provided in Tools 6. The order of iteration over an RRRRWWWWTTTTPPPPttttrrrrSSSSeeeetttt is dependent on the comparator object supplied as applied to the values stored in the container. The current item referenced by this iterator is undefined after construction or after a call to rrrreeeesssseeeetttt(((()))). The iterator becomes valid after being advanced with either a preincrement or ooooppppeeeerrrraaaattttoooorrrr(((()))). For both ooooppppeeeerrrraaaattttoooorrrr++++++++ and ooooppppeeeerrrraaaattttoooorrrr(((()))), iterating past the last element will return a value equivalent to boolean ffffaaaallllsssseeee. Continued increments will return a value equivalent to ffffaaaallllsssseeee until rrrreeeesssseeeetttt(((()))) is called. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee None EEEExxxxaaaammmmpppplllleeeessss #include<rw/tpset.h> #include<iostream.h> #include<rw/cstring.h> int main(){ RWTPtrSet<RWCString,less<RWCString> > a; RWTPtrSetIterator<RWCString,less<RWCString> > itr(a); a.insert(new RWCString("John")); PPPPaaaaggggeeee 1111 RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++)))) RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++)))) a.insert(new RWCString("Steve")); a.insert(new RWCString("Mark")); //Rejected, duplicate insertions not allowed a.insert(new RWCString("Steve")); for(;itr();) cout << *itr.key() <<endl; return 0; } Program Output John Mark PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss Steve RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr<<<<TTTT,,,,CCCC>>>>(const RWTPtrSet<T,C>& s); Creates an iterator for the set ssss. The iterator begins in an undefined state and must be advanced before the first element will be accessible PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss T* ooooppppeeeerrrraaaattttoooorrrr(((())))(); Advances self to the next element, dereferences the resulting iterator and returns its value. If the iterator has advanced past the last item in the container, the element returned will be a nnnniiiillll pointer equivalent to boolean ffffaaaallllsssseeee. PPPPaaaaggggeeee 2222 RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++)))) RRRRWWWWTTTTPPPPttttrrrrSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++)))) RWBoolean ooooppppeeeerrrraaaattttoooorrrr++++++++(); Advances self to the next element. If the iterator has been reset or just created self will now reference the first element. If, before iteration, self referenced the last association in the set, self will now reference an undefined value and a value equivalent to ffffaaaallllsssseeee will be returned. Otherwise, a value equivalent to ttttrrrruuuueeee is returned. Note: no post-increment operator is provided. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss RWTPtrSet<T,C>* ccccoooonnnnttttaaaaiiiinnnneeeerrrr(((()))) const; Returns a pointer to the collection being iterated over. T* kkkkeeeeyyyy() const; Returns the stored value pointed to by sssseeeellllffff. Undefined if self is not referencing a value within the set. void rrrreeeesssseeeetttt(); void rrrreeeesssseeeetttt(RWTPtrSet<T,C>& h); Resets the iterator so that after being advanced it will point to the first element of the collection. Using rrrreeeesssseeeetttt(((()))) with no argument will reset the iterator on the current container. Supplying a RRRRWWWWTTTTPPPPttttrrrrSSSSeeeetttt to rrrreeeesssseeeetttt(((()))) will reset the iterator on the new container. PPPPaaaaggggeeee 3333